package com.hjl.web.servlet;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 创建验证码
 * @author Lenovo
 * @date 2021/10/8 11:25
 * @version 1.0
 */
@WebServlet("/checkCode/*")
public class CheckCodeServlet extends BaseServlet {
    public void getCheckCode(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //定义图形验证码的长，宽，数量，障碍数
        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(80, 33,4,10);
        lineCaptcha.write(resp.getOutputStream());
        //存入session
        req.getSession().setAttribute("right",lineCaptcha);

    }

    public void isCheckCode(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


    }
}
